public class Test {
    public static void main(String[] args) {
        int a = 3;
        int b = 5;
        int c = (a+b)*2;
        System.out.println(c);//16
        a = 5;
        System.out.println(c);//16
        System.out.println("------------------");
        /**
         * （1）变量，只有赋值的时候，变量值才会发生改变，如果是关联性的变量，该变量也不会发生改变；例如上述：c变量，
         */
        Boy tom = new Boy(21, "tom");
        int d = tom.id + 1;
        System.out.println(d);
        System.out.println(tom);
        tom.id = 31;
        System.out.println(d);
        System.out.println(tom);
        System.out.println("--------------------");
        Boy.x = 10;
        System.out.println(Boy.x);
        Boy.x = 20;
        System.out.println(Boy.x);
        tom.x = 30;
        System.out.println(tom.x);
        Boy boy = new Boy();
        System.out.println(boy.x);

    }
}
class Boy{
    static int x;
    int id;
    String name;

    public Boy() {
    }

    public Boy(int id, String name) {
        this.id = id;
        this.name = name;
    }

    @Override
    public String toString() {
        return "boy{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}